home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2.sit / Raven 1.2 / • Extras • / SGI STL / stlconf.h < prev    next >
C/C++ Source or Header  |  1997-06-22  |  11KB  |  337 lines

  1. /*
  2.  *
  3.  * Copyright (c) 1997
  4.  * Moscow Center for SPARC Technology
  5.  *
  6.  * Permission to use, copy, modify, distribute and sell this software
  7.  * and its documentation for any purpose is hereby granted without fee,
  8.  * provided that the above copyright notice appear in all copies and
  9.  * that both that copyright notice and this permission notice appear
  10.  * in supporting documentation.  Moscow Center for SPARC Technology makes no
  11.  * representations about the suitability of this software for any
  12.  * purpose.  It is provided "as is" without express or implied warranty.
  13.  *
  14.  */
  15.  
  16. #ifndef __SGI_STL_STLCONF_H
  17. # define __SGI_STL_STLCONF_H
  18.  
  19. # undef __AUTO_CONFIGURED
  20.  
  21. //==========================================================
  22. // Getting proper values of autoconf flags
  23. // if you ran 'configure', __AUTO_CONFIGURED is set to 1 and
  24. // specific compiler fetures will be used.
  25. // Otherwise, the <stlcomp.h> header will be included for per-version
  26. // features recognition.
  27. //==========================================================
  28. # if defined ( BYPASS_AUTOCONF_SETTINGS ) || ! defined (__AUTO_CONFIGURED)
  29. // per-version compiler features recognition
  30. #  include <stlcomp.h>
  31. # else
  32. // auto-configured section
  33.  
  34. // define that to disable these features
  35. # undef __STL_NO_EXCEPTIONS
  36. # undef __STL_NO_NAMESPACES
  37.  
  38. // select allocation method you like
  39. # undef __STL_USE_MALLOC
  40. # undef __STL_USE_NEWALLOC
  41.  
  42. // this one is not mandatory, just enabled
  43. # undef __STL_USE_DEFALLOC
  44.  
  45. // define NO_USING_STD if don't want using STL namespace by default
  46. // new-style-headers define that to get proper behaviour
  47. # undef  __STL_NO_USING_STD
  48.  
  49. // define __STL_USE_ABBREVS if your linker has trouble with long 
  50. // external symbols
  51. # undef __STL_USE_ABBREVS
  52.  
  53.  
  54. // unsigned 32-bit integer type
  55. #  define __STL_UINT32_T unsigned
  56. #  undef __STL_BOOL_KEYWORD
  57. #  undef __STL_RESERVED_BOOL_KEYWORD
  58. #  undef __STL_YVALS_H
  59. #  undef __STL_DEFAULT_TEMPLATE_PARAM
  60. #  undef __STL_DEFAULT_TYPE_PARAM
  61. #  undef __STL_STATIC_TEMPLATE_DATA
  62. #  undef __STL_RAND48
  63. #  undef __STL_LOOP_INLINE_PROBLEMS
  64. #  undef __STL_NAMESPACES
  65. #  undef __STL_TYPENAME
  66. #  undef __STL_EXPLICIT
  67. #  undef __STL_USE_EXCEPTIONS
  68. #  undef __STL_EXCEPTION_SPEC
  69. #  undef __STL_WEAK_ATTRIBUTE
  70. #  undef __STL_BASE_MATCH_BUG
  71. #  undef __STL_NESTED_TYPE_PARAM_BUG
  72. #  undef __STL_UNUSED_REQUIRED_BUG
  73. #  undef __STL_UNINITIALIZABLE_PRIVATE
  74. #  undef __STL_BASE_TYPEDEF_BUG
  75. #  undef __STL_BASE_TYPEDEF_OUTSIDE_BUG
  76. #  undef __STL_CONST_CONSTRUCTOR_BUG
  77.  
  78. #  undef __STL_NEW_HEADER_NAMES
  79. #  undef __STL_NEW_STYLE_CASTS
  80. #  undef __STL_WCHAR_T
  81. #  undef __STL_LONG_LONG
  82. #  undef __STL_LONG_DOUBLE
  83. #  undef __STL_MUTABLE
  84. #  undef __STL_FULL_SPEC_SYNTAX
  85. #  undef __STL_BAD_ALLOC_DEFINED
  86. #  undef __STL_DEBUG_ALLOC
  87. #  undef __STL_MEMBER_TEMPLATES
  88. #  undef __STL_FRIEND_TEMPLATES
  89. #  undef __STL_CLASS_PARTIAL_SPECIALIZATION
  90. #  undef __STL_FUNC_PARTIAL_ORDERING
  91. #  undef __STL_AUTOMATIC_TYPE_TRAITS
  92. #  undef __STL_MEMBER_POINTER_PARAM_BUG
  93. # endif /* AUTO_CONFIGURED */
  94.  
  95. //==========================================================
  96.  
  97. //==========================================================
  98. // final workaround tuning based on given flags
  99. //==========================================================
  100.  
  101. // some justification
  102.  
  103. # if !defined ( __STL_STATIC_TEMPLATE_DATA )
  104. #   define __STL_STATIC_TEMPLATE_DATA 0
  105. #  if !defined ( __STL_WEAK_ATTRIBUTE )
  106. #   define __STL_WEAK_ATTRIBUTE 0
  107. #  endif
  108. # endif
  109.  
  110. # if defined (__STL_BASE_TYPEDEF_BUG)
  111. #  undef  __STL_BASE_TYPEDEF_OUTSIDE_BUG
  112. #  define __STL_BASE_TYPEDEF_OUTSIDE_BUG 1
  113. # endif
  114.  
  115. // features tuning 
  116. # ifdef __STL_DEBUG
  117. #  define __STL_ASSERTIONS 1
  118. # endif
  119.  
  120. # ifdef __STL_ASSERTIONS
  121. #  if RAVEN                    // ・・・ハJDJ
  122. #    define __stl_assert        ASSERT
  123. #  else
  124. #   define __stl_assert(expr) ¥
  125.      if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s¥n", ¥
  126.               __FILE__, __LINE__, # expr); abort(); }
  127. #  endif
  128. # else
  129. #  define __stl_assert(expr)
  130. # endif
  131.  
  132. # ifdef __STL_DEBUG
  133. #  if RAVEN                    // ・・・ハJDJ
  134. #   define __stl_verbose_assert(expr,diagnostic) ¥
  135.      if (!(expr)) DEBUGSTR(diagnostic)
  136. #  else
  137. #   define __stl_verbose_assert(expr,diagnostic) ¥
  138.      if (!(expr)) { fprintf(stderr, "%s:%d STL error : %s¥n%s:%d STL assertion failure: %s¥n",¥
  139.               __FILE__, __LINE__ , diagnostic, __FILE__, __LINE__ , # expr ); abort(); }
  140. #  endif
  141. #  define __stl_debug_check(expr) __stl_assert(expr)
  142. #  define __stl_debug_do(expr) expr
  143. # else
  144. #  define __stl_verbose_assert(expr,diagnostic) __stl_assert(expr)
  145. #  define __stl_debug_check(expr)
  146. #  define __stl_debug_do(expr)
  147. # endif
  148.  
  149. # ifdef __STL_RAND48
  150. #  define __rand lrand48
  151. # else
  152. #  define __rand rand
  153. # endif
  154.  
  155. // tuning of static template data members workaround
  156. # if ( __STL_STATIC_TEMPLATE_DATA < 1 )
  157. // ignore __PUT directive in this case
  158. #  if ( __STL_WEAK_ATTRIBUTE > 0 )
  159. #   define __DECLARE_INSTANCE(type,item,init) type item __attribute__ (( weak )) = init
  160. #  else
  161. #   ifdef __PUT_STATIC_DATA_MEMBERS_HERE
  162. #    define __DECLARE_INSTANCE(type,item,init) type item = init
  163. #   else
  164. #    define __DECLARE_INSTANCE(type,item,init)
  165. #   endif /* __PUT_STATIC_DATA_MEMBERS_HERE */
  166. #  endif /* __STL_WEAK_ATTRIBUTE */
  167. # endif /* __STL_STATIC_TEMPLATE_DATA */
  168.  
  169. // default parameters as template types derived from arguments ( not always supported )
  170. #  if ! defined (__STL_DEFAULT_TEMPLATE_PARAM)
  171. #   define __DFL_TMPL_PARAM( classname, defval ) class classname
  172. #   define __DFL_TMPL_ARG(classname) , classname
  173. #  else
  174. #   define __STL_DEFAULT_TYPE_PARAM 1
  175. #   define __DFL_TMPL_PARAM( classname, defval ) class classname = defval
  176. #   define __DFL_TMPL_ARG(classname)  
  177. #  endif
  178.  
  179. // default parameters as complete types
  180. # if defined ( __STL_DEFAULT_TYPE_PARAM )
  181. #   define __DFL_TYPE_PARAM( classname, defval ) class classname = defval
  182. #   define __DFL_TYPE_ARG(classname)
  183. # else
  184. #  define __DFL_TYPE_PARAM( classname, defval ) class classname
  185. #  define __DFL_TYPE_ARG(classname) , classname
  186. # endif
  187.  
  188. // default parameters workaround tuning
  189. #  if defined  ( __STL_DEFAULT_TYPE_PARAM ) || ( defined ( __STL_NAMESPACES )&&! defined (__STL_NO_NAMESPACES))
  190. #    define __WORKAROUND_RENAME(X) X
  191. #  else
  192. #    define __WORKAROUND_RENAME(X) __##X
  193. #  endif
  194.  
  195. // namespace selection
  196. # if defined (__STL_NAMESPACES) && ! defined (__STL_NO_NAMESPACES)
  197.  
  198. // change this if don't think that is standard enough ;)
  199. #  define __STL_NAMESPACE std
  200. #  define __BEGIN_STL_NAMESPACE namespace __STL_NAMESPACE {
  201. #  define __STL_USING_NAMESPACE  using namespace __STL_NAMESPACE ;
  202.  
  203. #  ifdef __STL_NO_USING_STD
  204. #   define __USING_NAMESPACE
  205. #  else
  206. #   define __USING_NAMESPACE using namespace __STL_NAMESPACE ;
  207. #  endif
  208. #  ifdef __STL_DEFAULT_TYPE_PARAM
  209. #    define __STL_FULL_NAMESPACE __STL_NAMESPACE
  210. #    define __BEGIN_STL_FULL_NAMESPACE
  211. #    define __END_STL_FULL_NAMESPACE
  212. #  else
  213. #    define __STL_FULL_NAMESPACE sgi_full
  214. #    define __BEGIN_STL_FULL_NAMESPACE namespace __STL_FULL_NAMESPACE {
  215. #    define __END_STL_FULL_NAMESPACE } ;
  216. #  endif
  217. #  define __END_STL_NAMESPACE }; __USING_NAMESPACE
  218.     // workaround tuning
  219. #  define __FULL_NAME(X) __STL_FULL_NAMESPACE::__WORKAROUND_RENAME(X)
  220. # else /* __STL_NAMESPACES */
  221. #  define __STL_NAMESPACE
  222. #  define __STL_FULL_NAMESPACE
  223. #  define __BEGIN_STL_NAMESPACE
  224. #  define __END_STL_NAMESPACE
  225. #  define __BEGIN_STL_FULL_NAMESPACE
  226. #  define __END_STL_FULL_NAMESPACE
  227. #  define __STL_USING_NAMESPACE
  228.     // workaround tuning
  229. #  define __FULL_NAME(X) __WORKAROUND_RENAME(X)
  230. # endif  /* __STL_NAMESPACES */
  231.  
  232. #  define __STL_NAME(name) __STL_NAMESPACE::name  // Lo Russo Graziano <Graziano.LoRusso@CSELT.IT>
  233.  
  234.  
  235. // advanced keywords usage
  236. #  ifdef  __STL_NEW_STYLE_CASTS
  237. #   define __CONST_CAST(x,y) const_cast<x>(y)
  238. #  else
  239. #   define __CONST_CAST(x,y) ((x)y)
  240. #  endif
  241.  
  242. #  ifndef __STL_TYPENAME
  243. #   define typename
  244. #  endif
  245.  
  246. #  ifndef __STL_EXPLICIT
  247. #   define explicit
  248. #  endif
  249.  
  250. #  ifdef __STL_MUTABLE
  251. #   define __ASSIGN_MUTABLE(type,x,y) x=y
  252. #  else
  253. #   define __ASSIGN_MUTABLE(type,x,y) __CONST_CAST(type,x)=y
  254. #   define mutable
  255. #  endif
  256.  
  257. // exception-specific macros.
  258. // most of them require double parens : (())
  259. #  if defined ( __STL_NO_EXCEPTIONS) || ! defined (__STL_USE_EXCEPTIONS)
  260. #  define __TRY    
  261. #  define __CATCH(x)      if (false)   
  262. #  define __THROW(arg)    
  263. #  define __RETHROW
  264. #  else
  265. #  define __CATCH(x)      catch x
  266. #  define __TRY           try
  267. #  define __THROW(arg)    throw arg
  268. #  define __RETHROW       throw
  269. #  endif
  270.  
  271. // throw specification ( used in inline constructors 
  272. // to improve efficiency some compilers )
  273. // param count is variable, parens used.
  274. #  if defined ( __STL_NO_EXCEPTIONS ) || ! defined ( __STL_EXCEPTION_SPEC )  
  275. #   define __THROWS(x)
  276. #  else
  277. #   define __THROWS(x) throw x
  278. #  endif
  279.  
  280. #  if defined (__STL_LOOP_INLINE_PROBLEMS)
  281. #   define INLINE_LOOP
  282. #  else
  283. #   define INLINE_LOOP inline 
  284. #  endif
  285.  
  286. #if defined ( __STL_UNINITIALIZABLE_PRIVATE )
  287. #  define __PRIVATE public
  288.    // Extra access restrictions prevent us from really making some things
  289.    // private.
  290. #else
  291. #  define __PRIVATE private
  292. #endif
  293.  
  294. #  ifdef __STL_FULL_SPEC_SYNTAX
  295. #   define __STL_FULL_SPECIALIZATION template<>
  296. #  else
  297. #   define __STL_FULL_SPECIALIZATION
  298. #  endif
  299.  
  300. #  define __IMPORT_CONTAINER_TYPEDEFS(super)                            ¥
  301.     typedef typename super::value_type value_type;                               ¥
  302.     typedef typename super::reference reference;                                 ¥
  303.     typedef typename super::size_type size_type;                                 ¥
  304.     typedef typename super::const_reference const_reference;                     ¥
  305.     typedef typename super::difference_type difference_type;
  306.  
  307. #  define __IMPORT_ITERATORS(super)                                              ¥
  308.     typedef typename super::iterator iterator;                                   ¥
  309.     typedef typename super::const_iterator const_iterator; 
  310.  
  311. #  define __IMPORT_REVERSE_ITERATORS(super)                                      ¥
  312.     typedef typename super::const_reverse_iterator  const_reverse_iterator;      ¥
  313.     typedef typename super::reverse_iterator reverse_iterator;
  314.  
  315. #define  __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name)         ¥
  316.     __derived_name(const self& x) : super(x) {}                 ¥
  317.     __derived_name(const super& x) : super(x) {}                ¥
  318.     self& operator=(const self& x) {                            ¥
  319.         super::operator=(x);                                    ¥
  320.         return *this;                                           ¥
  321.     }                                                           ¥
  322.     self& operator=(const super& x) {                           ¥
  323.         super::operator=(x);                                    ¥
  324.         return *this;                                           ¥
  325.     }
  326.  
  327. # if defined (__STL_BASE_TYPEDEF_OUTSIDE_BUG) || defined (__STL_NESTED_TYPE_PARAM_BUG)
  328. #   define __CONTAINER_SUPER_TYPEDEFS ¥
  329.  __IMPORT_CONTAINER_TYPEDEFS(super) __IMPORT_ITERATORS(super) __IMPORT_REVERSE_ITERATORS(super)
  330. # else
  331. #   define __CONTAINER_SUPER_TYPEDEFS
  332. # endif
  333.  
  334. //==========================================================
  335.  
  336. #endif /* __STLCONF_H */
  337.